<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>米行域名批量交易平台-我要投资</title>
<include file="./Public/public/public.html" />
<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/detail.css">
<link rel="stylesheet" type="text/css" href="{$app_path}{$static_path}/css/bootstrap.css">
</head>
<body>
	<include file="./Public/public/top.html" />
	<section class="">
			<div class="container jkxq">
				<div class="row">
					<div class="col-sm-2">
					</div>
				</div>
				<div class="row">
					<ol class="breadcrumb hidden-xs">
						<li><a href="/">首页</a></li>
						<li><a href="/Investment/lend.html">我要理财</a></li>
						<li><a href="/Investment/lend.html">借款详情</a></li>
						<li class="active">{$info.title}</li>
					</ol>
					<div class="col-sm-12 jkxq_info">
						<div class="col-sm-8 left">
							<div class="info">
								<h2>{$username} 贷款 ￥{$info.money}元</h2>
								<table>
									<tbody>
									<tr>
										<td>
											<h3>年利率</h3>
											{$info.rate}%
										</td>
										<td>
											<h3>借款金额</h3>
											￥{$info.money}元
										</td>
										<td>
											<h3>借款期限</h3>
											<if condition="$info['term']-30 lt 0">
											{$info.term}天
											<else/>
											{$info['term']/30}个月			
											</if>							
											</td>
										<td>
											<h3>还款方式</h3>
											每月还息
										</td>
									</tr>
									</tbody>
								</table>
								<ul>
									<li>
										<div class="labels">投资进度：</div>
										<div class="progress_area">
											<div class="progress">
												<div class="progress-bar progress-bar-success progress-bar-striped active " role="progressbar" aria-valuenow="40" aria-valuemin="0" 
												aria-valuemax="100" style="width:{$info['tovalue']/$info['money']*100|round=###,0}%;">
												</div>
											</div>
										</div>
										<span class="progress_info">{$info['tovalue']/$info['money']*100|round=###,0}%</span>
										<div class="clear"></div>
									</li>
									<li>
										<div class="labels">发标时间：</div>
										{$info.create_time} &nbsp;&nbsp; 过期时间：{$info.overtime} 										
										<div class="clear"></div>
									</li>
									
									<li>
										<div class="labels">抵押域名：</div>
										<span class="amount-pay-out">{$info.domainnum}个-{$catename}</span>
										<div class="clear"></div>
									</li>
									
									<li>
										<div class="labels">当前状态：</div>
										<span class="amount-pay-out">
										<if condition="$info['money']-$info['tovalue'] eq 0">
											还款中
										<else/>
											正在借款
										</if>
										</span>
										<div class="clear"></div>
									</li>
									
									<li>
										<div class="labels">还需：</div>
										<span class="amount-pay-out">￥{$shengyu}</span>
										<div class="clear"></div>
									</li>
									<li>
										<div class="labels">借款描述：</div>
										<div class="description">
																	{$info.descrp}	
																		
																					</div>
										<div class="clear"></div>
									</li>
								</ul>
							</div>
						</div>
						<div class="col-sm-4 right">
							<div class="info">
							<p>
							<strong>您的账户余额<span class="amount-pay-in" id="ye" data-amount="21.91">￥{$creditmoney}</span><br>
											该笔贷款还需<span class="font_c_r" id="hc" data-amount="50000.00">￥{$shengyu}</span>
										</strong></p>
								<p>
									投资<span class="amount-pay-out">100</span>元，
									期限<span class="font_c_blue">1 个月</span>，
									可获得利息收益
                            <span class="amount-pay-in">￥{$info['rate']/12*1|round=###,2}</span>
								</p>
								<p class=" font_c_grey">最小投资额：¥100.00   当前 总投资数：{$info['tovalue']/100}</p>
								<p>
									
									<div class="form-inline">
											<div class="form-group">
											<if condition="$info['money']-$info['tovalue'] eq 0">
											<else/>
												<label for="inputAmount"><i>*</i>输入金额：</label>
												<input class="form-control" id="inputAmount" name="Amount" type="number" value="0">
												<span class="form-control-tips"><i class="iconfont"></i>投资金额必须是100的整数倍</span>
											</if>
											</div>
											<div class="table_area">
												<table class=" table table-bordered text-center">
													<tbody>
													<tr>
														<th scope="row">年利率</th>
														<td>
															{$info.rate}%
															<input id="inputRate" name="Rate" type="hidden" value="0.1600">
															<input id="inputLoanCycle" name="LoanCycle" type="hidden" value="7">
														</td>
													</tr>
													<tr>
														<th scope="row">每期利息收益</th>
														<td id="nsy">￥
														0.0
														</td>
													</tr>
													</tbody>
												</table>
											</div>
											<if condition="$info['money']-$info['tovalue'] eq 0">
											<input type="button" class="btn btn-primary2 btn-warning btn-xs-block"
											 value="还款中">
											<else/>
											<input type="button" class="btn btn-primary2 btn-warning btn-xs-block"
											 value="确定投资" id="touziBut">
											</if>
										</div>
										
								</p>
							</div>
						</div>
						<div class="double_line"></div>
					</div>
				</div>
			</div>
		</section>
		
	<include file="./Public/public/footer.html" />
	<script type="text/javascript">
	$("#inputAmount").blur(function(){
		var term = "{$info.term}";
		var rate = "{$info.rate}";
		if(checkinput($(this).val())){
			if(parseInt(term)-30>0){
				$("#nsy").text("￥"+($(this).val()*parseInt(term/30)*rate*0.01/12).toFixed(2));
			}else{
				$("#nsy").text("￥"+($(this).val()*term*rate*0.01/360).toFixed(2));
			}
		}
	});
	$("#touziBut").click(function(){
		if(checkinput($("#inputAmount").val())){
			var id="{$info.id}";
			$.ajax({  
				url:"{:U('Mycredit/toinver')}",
				data:{'id':id,'money':$('#inputAmount').val()},
				dataType:'json',
				type:'post',
				success:function(data){
					showModal({msg:data.info});	
				}
			});
		}
	});
	
	function checkinput(num){
		if(num==0){
			showModal({msg:"请输入100的整数倍"});
			return false;
		}
		else if(num%100!=0){
			showModal({msg:"请输入100的整数倍"});
			return false;
		}
		else if(num>parseInt('{$shengyu}')){
			showModal({msg:"此项目最大可投资{$shengyu}元"});
			return false;
		}
		return true;
	}
	</script>
</body>
</html>